package com.zjw.demo.controller;

import com.zjw.demo.pojo.Books;
import com.zjw.demo.service.BookSerivce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author:zhaojiawei
 * @Date: 2023/3/20 16:03
 */

@RestController
@RequestMapping("/book")
public class BookController {

    @Autowired
    private BookSerivce serivce;


    @RequestMapping("/select")
    public List<Books> select(){
        return serivce.selectBooks();
    }

    @RequestMapping("insert")
    public boolean insert(@RequestBody Books book){
        boolean flag = serivce.insert(book);
        return true;
    }

    @RequestMapping("updateById")
    public int updateById(@RequestBody Books books){
        int res = serivce.updateById(books);
        return res;
    }
}
